home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
NOVA - For the NeXT Workstation
/
NOVA - For the NeXT Workstation.iso
/
Documents
/
NeXTAnswers
/
objc.808
< prev
next >
Wrap
Text File
|
1992-02-06
|
4KB
|
104 lines
{\rtf0\ansi{\fonttbl\f0\fnil Times-Roman;\f1\fswiss Helvetica;}
\paperw12400
\paperh9240
\margl120
\margr1000
{\colortbl\red0\green0\blue0;}
\pard\tx1140\tx2300\tx3440\tx4600\tx5760\tx6900\tx8060\tx9200\tx10360\tx11520\f0\b0\i0\ul0\fs28\fc0 size types storage\
\pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600 \
Q: How many bytes of storage do the various fundamental data types take in the NeXT implementation?\
\
Q: What are the maximum and minimum values for the various arithmetic data types?\
\
A: \
TYPE SIZE MINIMUM MAXIMUM\
\b char
\b0 1 byte = 8 bits -128 127\
\b unsigned char
\b0 1 byte = 8 bits 0 255\
\b short
\b0 2 bytes = 16 bits
\pard\tx1140\tx2300\tx3440\tx4600\tx5760\tx6900\tx8060\tx9200\tx10360\tx11520\fc0 -32768
\pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\fc0
\pard\tx1140\tx2300\tx3440\tx4600\tx5760\tx6900\tx8060\tx9200\tx10360\tx11520\fc0 3276
\pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\fc0 7\
\b unsigned short
\b0 2 bytes = 16 bits 0
\pard\tx1140\tx2300\tx3440\tx4600\tx5760\tx6900\tx8060\tx9200\tx10360\tx11520\fc0 65535
\pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600 \
\b int
\b0 4 bytes = 32 bits
\pard\tx1140\tx2300\tx3440\tx4600\tx5760\tx6900\tx8060\tx9200\tx10360\tx11520\fc0 -2147483648
\pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600
\pard\tx1140\tx2300\tx3440\tx4600\tx5760\tx6900\tx8060\tx9200\tx10360\tx11520\fc0 2147483647
\pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600 \
\b long
\b0 4 bytes = 32 bits
\pard\tx1140\tx2300\tx3440\tx4600\tx5760\tx6900\tx8060\tx9200\tx10360\tx11520\fc0 -2147483648
\pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600
\pard\tx1140\tx2300\tx3440\tx4600\tx5760\tx6900\tx8060\tx9200\tx10360\tx11520\fc0 2147483647
\pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600 \
\b unsigned int
\b0
\b
\b0 4 bytes = 32 bits 0
\pard\tx1140\tx2300\tx3440\tx4600\tx5760\tx6900\tx8060\tx9200\tx10360\tx11520\fc0 4294967295
\pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600 \
\b unsigned long
\b0 4 bytes = 32 bits 0
\pard\tx1140\tx2300\tx3440\tx4600\tx5760\tx6900\tx8060\tx9200\tx10360\tx11520\fc0 4294967295
\pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600 \
\b float
\b0 4 bytes = 32 bits
\pard\tx1140\tx2300\tx3440\tx4600\tx5760\tx6900\tx8060\tx9200\tx10360\tx11520\fc0 1.17549435e-38f
\pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600
\pard\tx1140\tx2300\tx3440\tx4600\tx5760\tx6900\tx8060\tx9200\tx10360\tx11520\fc0 3.40282347e+38f
\pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600 \
\b double
\b0 8 bytes = 64 bits
\pard\tx1140\tx2300\tx3440\tx4600\tx5760\tx6900\tx8060\tx9200\tx10360\tx11520\fc0 2.225073858507201e-308
\pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\fc0 \
\pard\tx1140\tx2300\tx3440\tx4600\tx5760\tx6900\tx8060\tx9200\tx10360\tx11520\fc0 1.797693134862316e+308
\pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600 \
\
• The
\b unsigned
\b0 and
\b signed
\b0 keywords don't change the size of the type they qualify. \
• Pointers occupy 4 bytes.\
• The
\b void
\b0 type occupies no space. \
\
If you happen to forget any of the sizes, you can quickly remind yourself by running gdb and typing:\
print sizeof(
\i type
\i0 )\
\fc0 \
The minimum and maximum values are defined as constants in
\b <limits.h>
\b0 and
\b <float.h>
\b0 .\
\
QA808\
\
Valid for 1.0\
Valid for 2.0\
\